
/**
  * @file       IST8310driver.c/h
  * @brief      ist8310 is a 3-axis digital magnetometer, the file includes initialization function,
  *             read magnetic field strength data function.
  * @note       IST8310 only support I2C
  * @history
  *  Version    Date            Author          Modification
  *  V1.0.0     Dec-26-2018     RM              1. 完成
  *
  */

#ifndef IST8310DRIVER_H
#define IST8310DRIVER_H
#include "main.h"
#include "i2c.h"
#include "gpio.h"

#define IST8310_DATA_READY_BIT 2

#define IST8310_NO_ERROR 0x00
#define IST8310_NO_SENSOR 0x40

extern float magnetism[3];

typedef struct ist8310_real_data_t
{
  uint8_t status;
  float mag[3];
} ist8310_real_data_t;

uint8_t ist8310_init(void);
void ist8310_read_over(uint8_t *status_buf, ist8310_real_data_t *ist8310_real_data);
void ist8310_read_mag(float mag[3]);



#endif
